//
// Created by redcat1 on 03.05.2024.
//

#ifndef TASK_ARRAY_VECTOR_EXCEPTION_H
#define TASK_ARRAY_VECTOR_EXCEPTION_H

#include <string>

// Base class for vector exceptions
class VectorException
{};

//
class VectorSizeException : public VectorException
{
protected:
  VectorSizeException(int size_, int capacity_=-1) : size(size_), capacity(capacity_) {}

public:
  std::string what() const;

protected:
  int size; // size of the vector
  int capacity; // capacity of the vector
};

//
class VectorNegativeSize : public VectorSizeException
{
public:
  VectorNegativeSize(int size_) : VectorSizeException(size_) {}
};

//
class VectorBiggerThanCapacity : public VectorSizeException
{
public:
  VectorBiggerThanCapacity(int size_, int capacity_) : VectorSizeException(size_, capacity_) {}
};

//
class VectorIndexOutOfRange : public VectorException
{
public:
  VectorIndexOutOfRange(int index_, int size_) : VectorException(), index(index_), size(size_) {}
  std::string what() const;

private:
  int index;
  int size;
};

#endif //TASK_ARRAY_VECTOR_EXCEPTION_H
